<!--start of blog-->
<div class="post">

<table width=600>
  <tr>
    <td>
      <h3><b><%=@blog.title%></b></h3>   
    </td>
  </tr>
  <tr>
    <td height=20 valign="top"> <%=@blog.created_at.to_s(:chs)%> </td>
    </tr>
    <td> <div class="entry"> <%=@blog.content %> </div> </td>
    </tr>
    <tr>
      <td> 
        类别：<%=link_to category_name(@blog), category_link(@blog) %>
        <%=" | 评论(#{@blog.comments.size}) | 浏览(#{@blog.view_count})" %>)
      </td>
    </tr>
  </table>
  </div>
  <!--end of blog-->
  
  <!--comments list begins-->
  <div id="comments">
    <%@comments.each do |comment|%>
      <table width=600 >
        <tr bgcolor="#aabbaa">
          <td width=40%><b><%= comment.name %></b></td>
          <td width=60%><%=comment.created_at.to_s(:chs)%></td>
          </tr>
          <tr bgcolor="#eeffee">
            <td colspan="2"><%=comment.content %></td>
          </tr>
        </table>
      <%end%>
      <%=will_paginate @comments,:blog_id=>@blog %>
    </div>
    <!--comments list ends-->
    <%= error_messages_for 'comment' %>
    <div id="notice"><%=flash[:notice]%> </div>
      <!--comments input begins-->
      <div id="comment_form">
        <fieldset>
          <legend>添加评论</legend>
          <% form_for :comment,
          :url=>{:action=>'add_commnet',
            :id=>@blog} do |form| %>
            <p>
              <label for="comment_name" >姓名:</label>
              <%=form.text_field :name, :size=>20 %>
            </p>
            <p>
              <label for="comment_email" >电子邮件:</label>
              <%=form.text_field :email, :size=>20 %>
            </p>
            <p>
              <%= show_simple_captcha :label =>"请输入识别码" %>
            </p>
            <p>
              <label for="comment_content" >内容:</label>
              <%= form.text_area :content, :rows => 3, :cols => 40 %>
            </p>
            <p>
              <%= submit_tag "提交" %>    
            </p>
          <% end %>
        </fieldset>
      </div>
      <!--comments input ends-->